import 'package:ducafe_ui_core/ducafe_ui_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mes_app/common/index.dart';
import 'package:get/get.dart';

import 'index.dart';

class LoadingPage extends GetView<LoadingController> {
  const LoadingPage({super.key});

  // 主视图
  Widget _buildView() {
    return <Widget>[
       ButtonWidget.primary("show", onTap: controller.onShow),
       ButtonWidget.primary("toast", onTap: controller.onToast),
       ButtonWidget.primary("success", onTap: controller.onSuccesst),
       ButtonWidget.primary("error", onTap: controller.onError),
    ].toColumnSpace().marginOnly(top: 100.h).center().scrollable();
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<LoadingController>(
      init: LoadingController(),
      id: "loading",
      builder: (_) {
        return Scaffold(
          appBar: AppBar(title: const Text("loading")),
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
